package com.psq.core.common.network

import com.psq.core.common.model.ApiResponse
import com.psq.core.common.model.SSOApiResponse
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

open class BaseRepository {

    suspend fun <T> apiCall(api: suspend () -> ApiResponse<T>): ApiResponse<T> {
        return withContext(Dispatchers.IO) { api.invoke() }
    }

    suspend fun <T> ssoApiCall(api: suspend () -> SSOApiResponse<T>): SSOApiResponse<T> {
        return withContext(Dispatchers.IO) { api.invoke() }
    }
}